package com.zhuzhe.blog.oauth2.mobile;

import com.aliyuncs.exceptions.ClientException;
import com.zhuzhe.blog.utils.RedisUtil;
import org.springframework.beans.factory.annotation.Autowired;

/**
 * @description
 * @author: u53
 * @create: 2020-11-20 14:57
 **/

public class SmsSendImpl implements SmsSend {

    @Autowired
    private RedisUtil redisUtil;

    @Override
    public Boolean sendSms(String telephone, String code) throws ClientException {

        Boolean sendSms = SmsUtils.sendSms(telephone,code);//发送短信
        if (sendSms){
            redisUtil.set(telephone,code);
        }
        return sendSms;
    }
}
